<?php
class PostModel extends Model {
  //自动完成
  protected $_auto = array (
    array('post_created', 'getTime',1,'callback'),
    array('post_createdby', 'getName',1,'callback'),
    array('post_updated','getTime',3,'callback'),
    array('post_updatedby','getName',3,'callback')
  );

  public function getName() {
    return $_SESSION['trackUser']['admin_id'];
  }

  public function getTime() {
    return time();
  }

  //自动验证
  protected $_validate = array(
    array('post_title','require','主标题必须填写'),
    array('post_subtitle','require','副标题必须填写'),
    array('post_thumb_url','require','缩略图必须上传'),
    array('post_title','','该主标题已存在',0,'unique',3)
  );
}
